Merged
Conversation
Signed-off-by: sczembor <stanislaw.czembor@gmail.com>
Contributor
Reviewer's GuideThis PR updates block retrieval to fetch raw block data as an ArrayBuffer (with a warning if missing) and converts it to a Buffer for Sequence diagram for updated block retrieval and processing in processFinalizedTransactionssequenceDiagram
participant Indexer
participant blocksDB
participant Block
participant MerkleTree
Indexer->>blocksDB: get(block_hash, { type: "arrayBuffer" })
blocksDB-->>Indexer: rawBlockBuffer
alt Block data found
Indexer->>Block: fromBuffer(Buffer.from(rawBlockBuffer))
Block-->>Indexer: block
Indexer->>MerkleTree: constructMerkleTree(block)
MerkleTree-->>Indexer: merkleTree
else Block data missing
Indexer->>Indexer: log warning and skip TX
end
Class diagram for updated Block instantiation in IndexerclassDiagram
class Indexer {
+processFinalizedTransactions()
+blocksDB: BlocksDB
}
class BlocksDB {
+get(key, options)
}
class Block {
+fromBuffer(buffer)
+fromHex(hex)
}
Indexer --> BlocksDB : uses
Indexer --> Block : instantiates
note for Block "fromBuffer(buffer) is now used instead of fromHex(hex)"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- You’re injecting the
nowtimestamp directly into multiple SQL statements, which prevents statement caching and forces a new prepare on each run — consider using bound parameters instead so the prepared statements can be reused. - Instead of console.log/console.warn, consider adopting a structured logging framework or a centralized logger to standardize log levels and output formats.
- When block data is missing from your KV store you simply warn and skip the transaction, which could leave it stuck; consider adding retry logic or marking it as failed after a threshold of missing attempts.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- You’re injecting the `now` timestamp directly into multiple SQL statements, which prevents statement caching and forces a new prepare on each run — consider using bound parameters instead so the prepared statements can be reused.
- Instead of console.log/console.warn, consider adopting a structured logging framework or a centralized logger to standardize log levels and output formats.
- When block data is missing from your KV store you simply warn and skip the transaction, which could leave it stuck; consider adding retry logic or marking it as failed after a threshold of missing attempts.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
robert-zaremba
approved these changes
Sep 18, 2025
Signed-off-by: sczembor <stanislaw.czembor@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdSummary by Sourcery
Fix buffer handling in block retrieval and clean up formatting of SQL queries and function arguments
Bug Fixes:
Enhancements: